﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hfm.Common.Entity.Employee;

namespace Hfm.Core.DataAccess.Employee
{
    public class EmployeeData
    {
        protected readonly CoreContext Context;

        public EmployeeData()
        {
            
        }

        public EmployeeData(CoreContext context)
        {
            Context = context;
        }
        /// <summary>
        /// 查询所有Employee
        /// </summary>
        /// <returns></returns>
        public virtual IList<EmployeeEntity> GetEmplyees()
        {
            var query = from E in Context.EmployeeEntities
                select E;

            return query.ToList();
        }
        /// <summary>
        /// 根据ID查询Employee
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public virtual EmployeeEntity GetEmplyeeName(int Id)
        {
            var query = from Em in Context.EmployeeEntities
                        where Em.Id == Id
                        select Em;
            return query.SingleOrDefault();
        }
    }
}
